﻿using System.Linq;

namespace IceDog.Lib.Poker.PokerClient
{
    public class Player
    {
        /// <summary>
        /// 玩家名字
        /// </summary>
        public string Name { get; private set; }
        /// <summary>
        /// 手牌
        /// </summary>
        public CardList PlayHand { get; private set; }

        private Player() { }

        public Player(string name)
        {
            this.Name = name;
            this.PlayHand = new CardList();
        }
        /// <summary>
        /// 胜利条件，玩家手牌所有花色相同即胜利
        /// </summary>
        /// <returns></returns>
        public bool HasWin()
        {
            bool win = true;
            Suit match = this.PlayHand[0].Suit;
            win = this.PlayHand.All(x => x.Suit == match);
            return win;
        }
    }
}
